package com.sumset.vista;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import com.sumset.clases.calculadora;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ventana extends JFrame implements ActionListener {
	private JTextField tfNum1;
	private JTextField tfNum2;
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JButton jButton1;
	private JLabel jlResultado;
	
	calculadora c;
	
	public ventana(){
		initGUI();
		c=new calculadora();
	}
	

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		int num1=Integer.parseInt(tfNum1.getText());
		int num2=Integer.parseInt(tfNum2.getText());
		int res=c.sumatoria(num1, num2);
		jlResultado.setText(res+"");
		
		
		
	}
	
	private void initGUI() {
		try {
			{
				getContentPane().setLayout(null);
				{
					tfNum1 = new JTextField();
					getContentPane().add(tfNum1);
					tfNum1.setBounds(87, 21, 62, 23);
				}
				{
					tfNum2 = new JTextField();
					getContentPane().add(tfNum2);
					tfNum2.setBounds(87, 60, 62, 23);
				}
				{
					jLabel1 = new JLabel();
					getContentPane().add(jLabel1);
					jLabel1.setText("numero1");
					jLabel1.setBounds(12, 24, 48, 16);
				}
				{
					jLabel2 = new JLabel();
					getContentPane().add(jLabel2);
					jLabel2.setText("numero2");
					jLabel2.setBounds(12, 63, 48, 16);
				}
				{
					jLabel3 = new JLabel();
					getContentPane().add(jLabel3);
					jLabel3.setText("Resultado");
					jLabel3.setBounds(226, 21, 52, 16);
				}
				{
					jlResultado = new JLabel();
					getContentPane().add(jlResultado);
					jlResultado.setBounds(309, 21, 58, 16);
				}
				{
					jButton1 = new JButton();
					getContentPane().add(jButton1);
					jButton1.setText("Suma");
					jButton1.setBounds(12, 110, 44, 23);
					jButton1.addActionListener(this);
				}
			}
			{
				this.setSize(425, 232);
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

}
